import { BaseEntity } from '@cool-midway/core';
import { Column, Entity, Index } from 'typeorm';

/**
 * cms模块-文章管理
 */
@Entity('cms_article')
export class CmsArticleEntity extends BaseEntity {
  @Index()
  @Column({ comment: '作者ID' })
  user_id: number;

  @Column({ comment: '分类ID' })
  category_id: number;

  @Column({ comment: '标题' })
  title: string;

  @Column({ comment: '描述', nullable: true })
  description: string;

  @Column({ comment: '文章内容', type: 'text' })
  content: string;

  @Column({ comment: '文章封面', nullable: true })
  cover: string;

  @Column({ comment: '文章状态 0-禁用 1-启用', default: 1 })
  status: number;

  @Column({ comment: '阅读数量', default: 0 })
  view_count: number;

  @Column({ comment: '喜欢数量、点赞数', default: 0 })
  like_count: number;

  @Column({ comment: '是否置顶', default: 0 })
  is_sticky: number;

  @Column({ comment: '阅读加精', default: 0 })
  is_essence: number;

  @Column({ comment: '评论状态：0关闭 1开放', default: 1 })
  comment_status: number;

  @Column({ comment: '评论数量', default: 0 })
  comment_count: number;

  @Column({ comment: '最后回复用户ID', nullable: true })
  last_comment_user_id: number;
}